callback for closing a db

Hi all,

does anybody know if it's possible to associate a callback with the closing 'x'?
I have a callback that fires when a user closes the dialog box with the proper button and I would like the same callback to fire when he just uses the 'x'.
Or is there a way to disable the controls in the upper right corner of the db?

Thanks in advance

Karl
kabr - Thu Jul 02 05:22:33 EDT 2009

Re: callback for closing a db
Peter_Albert - Thu Jul 02 06:09:54 EDT 2009

Hm, I wonder how you assigned a callback to the "Close" button and made it not fire when the user clicks the "X".

Anyway, here is the framework for a DB with a close callback which fires anytime the DB is closed.
 

void closeDB (DB db)
{
  print "Close DB callback"
  hide db
  destroy db
  db = null
}
DB baseDB = create("")
close(baseDB, true, closeDB)
show baseDB

 


Regards,

Peter

 

Re: callback for closing a db
llandale - Mon Jul 13 13:37:14 EDT 2009

Peter_Albert - Thu Jul 02 06:09:54 EDT 2009

Hm, I wonder how you assigned a callback to the "Close" button and made it not fire when the user clicks the "X".

Anyway, here is the framework for a DB with a close callback which fires anytime the DB is closed.
 

void closeDB (DB db)
{
  print "Close DB callback"
  hide db
  destroy db
  db = null
}
DB baseDB = create("")
close(baseDB, true, closeDB)
show baseDB

 


Regards,

Peter

 

This 'close' callback fires when you hit the close button and also when you 'X' the dialog.

If you specify 'false', the close button doesn't appear but the callback fires when you 'X' it. If you do that, you can specify a different 'apply' button with label 'Close', and then you can get two different behaviors, one for 'X' and one for Close.

  • Louie

Of course, be sure to debug your 'close' callback carefully, otherwise you may not be able to close the dialog. Adding "if (confirm("Close Dialog")) hide db" at the top is a reasonable debug for it.

Re: callback for closing a db
kabr - Tue Jul 14 08:51:23 EDT 2009

Thank you Peter and Louie for your responses.

The behaviour that you describe, is what I would have expected. But somehow we had some strange effects here that seemed to indicate that for a specific DXL closing via button did fire the callback but closing via 'x' did not.
But now I do not seem to be able to reproduce this.

Thank you anyway.

Karl